
import {
	rePayOrder //重新获取订单信息
} from '../api/order.js'

/**
 * 重新请求支付订单,存在订单：直接支付订单；
 * 不存在订单：重新生成订单；
 * 获取失败：取消订单，再生成。
 * {
    "amount":"1",
    "source":"1",
    "goodsName":"消费测试",
    "goodsDesc":"消费物品",
    "bizOrderNo":"4ebc4a64787b850e48c",
    "payeeId":"pai-pay-company0001",
    "payerId":"pai-pay-person0001",
    "payChannel":"6",  //3：电子钱包、6：中信
    "payMethod":"08",
    "bizOrderId":"15097775689359605yw",
    "walletId":""
}
 * 
 */
export const checkPayOrderInfo = (info, payCallback) => {
	if (!info || !info.orderVO || !info.orderVO.bizOrderId || !info.orderVO.bizOrderNo) {
		payCallback(null)
		return
	}
	//是否为重新支付订单,bizOrderId:业务订单Id，bizOrderNo：支付订单id
	//获取订单，存在直接走支付
	rePayOrder(info.orderVO.bizOrderNo).then(res => {
		if (!res.data || !res.data.data || res.data.code == 1007) {
			payCallback(null)
			return
		}
		payCallback(res.data)
	}).catch(err => {
		payCallback(null)
	})
}